<div data-hook="admin_payment_method_form_fields">

  <div data-hook="payment_method">

    <div class="row">
      <div class="col-xs-3">
        <div id="preference-settings">
          <div class="field">
            <%= f.label :type %>
            <%= collection_select(:payment_method, :type, @providers, :to_s, :name, {}, {:id => 'gtwy-type', :class => 'select2 fullwidth js-gateway-type'}) %>
          </div>

          <div class="field js-preference-source-wrapper">
            <%= f.label :preference_source %>
            <%= f.select(:preference_source, [[Spree.t(:preference_source_none), nil]] + @object.class.available_preference_sources, {}, class: 'select2 fullwidth js-preference-source') %>
          </div>

          <div class="gateway-settings js-gateway-settings">
            <% if @object.preference_source.present? %>
              <%= Spree.t :preference_source_using, name: @object.preference_source %>
            <% elsif !@object.new_record? %>
              <%= preference_fields(@object, f) %>
            <% end %>
          </div>

          <div class="info warning js-gateway-settings-warning"><%= Spree.t(:provider_settings_warning) %></div>
        </div>
        <div data-hook="display" class="field">
          <%= f.label :display_on %>
          <%= select(:payment_method, :display_on, Spree::PaymentMethod::DISPLAY.collect { |display| [Spree.t(display), display == :both ? nil : display.to_s] }, {}, {:class => 'select2 fullwidth'}) %>
        </div>
        <div data-hook="auto_capture" class="field">
          <%= f.label :auto_capture %>
          <%= select(:payment_method, :auto_capture, [["#{Spree.t(:use_app_default)} (#{Spree::Config[:auto_capture]})", ''], [Spree.t(:say_yes), true], [Spree.t(:say_no), false]], {}, {:class => 'select2 fullwidth'}) %>
        </div>
        <div data-hook="active" class="field">
          <%= label_tag nil, Spree::PaymentMethod.human_attribute_name(:active) %>
          <ul>
            <li>
              <%= radio_button :payment_method, :active, true %>
              <%= label_tag :payment_method_active_true, Spree.t(:say_yes) %>
            </li>
            <li>
              <%= radio_button :payment_method, :active, false %>
              <%= label_tag :payment_method_active_false, Spree.t(:say_no) %>
            </li>
          </ul>
        </div>
      </div>

      <div class="col-xs-6">
        <div data-hook="name" class="field">
          <%= f.label :name %>
          <%= f.text_field :name, :class => 'fullwidth' %>
        </div>
        <div data-hook="description" class="field">
          <%= f.label :description %>
          <%= f.text_area :description, {:cols => 60, :rows => 6, :class => 'fullwidth'} %>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>
